package com.farewell.blog.pojo;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author Farewell
 * @date 2021/2/1
 * <p>
 * 评论类
 */
@Data
@TableName("t_comment")
public class Comment implements Serializable {
    @TableId(type = IdType.ID_WORKER)
    private long id;
    private String nickname;
    private String email;
    private String content;
    private String avatar;
    @TableField("create_time")
    private Date createTime;
    @TableField("blog_id")
    private long blogId;
    @TableField("parent_comment_id")
    private long parentCommentId;
    @TableField(exist = false)
    private String parentNickname;
    @TableField(exist = false)
        private List<Comment> replyComments = new ArrayList<>();
    @TableField("admin_comment")
    private boolean adminComment;

    public Comment(long id, String nickname, String email, String content, String avatar, Date createTime, long blogId, long parentCommentId) {
        this.id = id;
        this.nickname = nickname;
        this.email = email;
        this.content = content;
        this.avatar = avatar;
        this.createTime = createTime;
        this.blogId = blogId;
        this.parentCommentId = parentCommentId;
    }

    public Comment() {
    }

}
